import request from '@/utils/request.js'

// 注册
export const userRegisterService = ({ username, password, repassword }) =>
  request.post('/api/reg', { username, password, repassword })
// 登录
export const userLoginService = ({ username, password }) =>
  request.post('/api/login', { username, password })

export const userGetUserService = () => request.get('/my/userinfo')

export const userUpdateUserService = ({ id, nickname, email }) =>
  request.put('/my/userinfo', { id, nickname, email })
// 跟新用户头像
export const userUpdateAvatarService = (data) =>
  request.patch('/my/update/avatar', {
    avatar: data
  })
// 更新密码
export const userUpdatePasswordService = (data) => request.patch('/my/updatepwd', data)
